package com.gz.service;

import com.gz.dao.UserDao;
import com.gz.entity.User;

import java.util.List;

public class UserService {
    private UserDao userDao=new UserDao();

    public User getUserByName(String username) {
        User user = userDao.querySingle("select * from `user` where username=?",
                User.class, username);
        return user;
    }

    public boolean addUser(User user){
        int update = userDao.update("insert into user values(?,?,?,?)",user.getId(),user.getUsername(),user.getPwd(),user.getEmail());
        if(update>0){
            return true;
        }
        return false;
    }
}
